package cn.exrick.xboot.modules.transport.entity;

import cn.exrick.xboot.base.XbootBaseEntity;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.github.binarywang.wxpay.bean.result.WxPayUnifiedOrderV3Result;
import com.github.binarywang.wxpay.bean.result.enums.TradeTypeEnum;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.*;
import lombok.experimental.Accessors;

import javax.persistence.Transient;
import java.time.LocalDateTime;

/**
 * @author Exrickx
 */
@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
@EqualsAndHashCode(callSuper = true)
@Accessors(chain = true)
@TableName("b_deal_record")
@ApiModel(value="DealRecord", description="公用交易记录表")
public class DealRecord extends XbootBaseEntity {

    private static final long serialVersionUID = 1L;

    @ApiModelProperty(value = "交易流水号")
    private Long dealNumber;

    @ApiModelProperty(value = "交易类型 1 收入；2 支出")
    private Integer dealType;

    @ApiModelProperty(value = "交易金额")
    private Integer dealAmount;

    @ApiModelProperty(value = "交易时间")
    private LocalDateTime dealTime;

    @ApiModelProperty(value = "交易状态 0 待处理；1 已完成； 2 已取消")
    private Integer dealState;

    @ApiModelProperty(value = "单据类型 1 运单 ；2 仓点押金;")
    private Integer orderType;

    @ApiModelProperty(value = "单据id")
    private Long orderId;

    @ApiModelProperty(value = "支付类型 1 微信；2 支付宝；3 银行转账；4 分账系统（此处待定）")
    private Integer paymentType;

    @ApiModelProperty(value = "对接支付方流水号")
    private String paymentNumber;

    @ApiModelProperty(value = "关联id，退款流水时绑定付款流水")
    private Long relevanceId;

    @ApiModelProperty(value = "微信支付类型 APP、JSAPI 或 小程序、NATIVE、H5")
    @TableField(exist = false)
    private TradeTypeEnum wxTradeType;

    @ApiModelProperty(value = "微信支付调用这appcode， ma 小程序  mp 公众号  allInOne  一体机")
    @TableField(exist = false)
    private String wxAppTypeCode;

    @ApiModelProperty(hidden = true,value = "交易描述")
    @TableField(exist = false)
    private String dealDescription;

    @ApiModelProperty(value = "微信预支付请求信息")
    @TableField(exist = false)
    private WxPayUnifiedOrderV3Result.JsapiResult wechatPayInfo;

}
